<div class="row">
    <div class="col-sm-20">
        <h1 class="pagetitle" translate lib="web">provider</h1>
    </div>
</div>

<pre ng-show="ErrorMessage!=null">{{ ErrorMessage }}</pre>
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
<form ng-submit="ctrl.submit()" class="form-horizontal" role="form" autocomplete="off">

    <div class="form-group">
        <label for="provider" class="col-sm-2 control-label" translate lib="web">provider</label>
        <div class="col-sm-4">
            <select class="form-control" ng-model="ctrl.model.provider">
                <option value="saml">WS-Federation/SAML</option>
                <option value="google">Google OAuth</option>
                <option value="oidc">OpenID Connect</option>
                <option value="local">Username/Password</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label" translate lib="web">name</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.name" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.provider!='local'">
        <label for="id" class="col-sm-2 control-label" translate lib="web">Id</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.id" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.provider=='saml'">
        <label for="issuer" class="col-sm-2 control-label" translate lib="web">issuer</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.issuer" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.provider=='saml' || ctrl.model.provider=='oidc'">
        <label for="saml_federation_metadata" class="col-sm-2 control-label" translate lib="web">metadataurl</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.saml_federation_metadata" class="form-control input-md"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.provider=='google' || ctrl.model.provider=='oidc'">
        <label for="consumerKey" class="col-sm-2 control-label" translate lib="web">consumerkey</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.consumerKey" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.provider=='google' || ctrl.model.provider=='oidc'">
        <label for="consumerSecret" class="col-sm-2 control-label" translate lib="web">consumersecret</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.consumerSecret" class="form-control input-md"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-sm-2 control-label" translate lib="web">forceddomains</label>
        <div class="col-sm-4">
        </div>
    </div>
    <div class="form-group" ng-repeat="id in ctrl.model.forceddomains">
        <label class="col-sm-2 control-label" translate lib="web"></label>
        <div class="col-sm-4">
            {{ id }}
            <button type="button" ng-disabled="ctrl.loading==true" class="btn btn-danger" ng-click="ctrl.deleteforceddomains(id)"
                translate lib="web">delete</button>
        </div>
    </div>

    <div class="form-inline">
        <div class="form-group mb-2">
            <label class="sr-only" translate lib="web">addforceddomains</label>
        </div>
        <div class="form-group mx-sm-3 mb-2">
            <input ng-model="ctrl.newforceddomain" type="text" class="form-control" placeholder="New forced domain"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true" ng-click="ctrl.addforceddomains()">add domain</button>
    </div>

    <div class="form-group" ng-show="ctrl.model.provider=='saml'">
        <label for="saml_federation_metadata" class="col-sm-2 control-label" translate lib="web">embedsignout</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.saml_signout_url" class="form-control input-md"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>


    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" ng-disabled="ctrl.loading==true" class="btn btn-success" translate
                lib="web">Save</button>
        </div>
    </div>

    <div class="form-group" ng-show="ctrl.model.provider=='saml'">
        <label for="saml_federation_metadata" class="col-sm-2 control-label" translate lib="web">metadataurl</label>
        <div class="col-sm-4">
            <pre>https://{{ctrl.WebSocketClientService.domain}}/{{ctrl.model.id}}/FederationMetadata/2007-06/FederationMetadata.xml</pre>
            <a ng-href="https://{{ctrl.WebSocketClientService.domain}}/{{ctrl.model.id}}/FederationMetadata/2007-06/FederationMetadata.xml"
                target="_blank" rel="noreferrer">test</a>
        </div>
    </div>

    {{ctrl.WebSocketClientService.url}}

</form>